<script setup lang="js">
import { ref } from "vue";
import { useRouter } from "vue-router";
import {
  Search,
  ElemeFilled,
  Operation,
  ShoppingTrolley,
} from "@element-plus/icons-vue";
import { getCatalogPage } from '@/http/api/catalogApi';

const inputValue = ref("");
const router = useRouter();
function clickHandle() {
  var params = {
    pageNum: 1,
    pageSize: 20
  };
  getCatalogPage(params);
  router.push("/category");
};
// defineProps({
//   msg: {
//     type: String,
//     required: true
//   }
// });
</script>

<template>
  <header id="header">
    <div class="header-container">
      <RouterLink id="logo" to="/">
        <el-icon size="30px">
          <ElemeFilled />
        </el-icon>
        <span class="logo-name">GDOThaur</span>
      </RouterLink>
      <div class="category-menu" @click="clickHandle">
        <el-icon size="20px">
          <Operation />
        </el-icon>
        <span class="text">Categories</span>
      </div>
      <el-input
        class="head-search"
        v-model="inputValue"
        placeholder="Search"
        size="large"
        :suffix-icon="Search"
        :clearable="true"
      />
      <div class="shop-car">
        <el-icon size="26px">
          <ShoppingTrolley />
        </el-icon>
      </div>
    </div>
  </header>
</template>

<style lang="scss" scoped>
#header {
  width: 100%;
  height: 80px;
  background-color: #15803d;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;

  .header-container {
    margin: 10px auto 0;
    width: 153.6rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
}

#logo {
  width: 20.5rem;
  height: 40px;
  color: #fff;
  display: flex;
  align-items: center;

  .logo-name {
    margin-left: 4px;
    font-weight: 400;
    font-size: 20px;
  }
}

.category-menu {
  padding: 0 12px;
  height: 40px;
  display: flex;
  align-items: center;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;

  &:hover {
    background-color: #166534;
  }

  .text {
    margin-left: 6px;
    font-size: 16px;
    font-weight: 500;
  }
}

.head-search {
  width: 100rem;

  :deep(.el-input__wrapper) {
    border-radius: 8px;
  }
}

.shop-car {
  padding: 0 9px;
  height: 40px;
  display: flex;
  align-items: center;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;

  &:hover {
    background-color: #166534;
  }
}
</style>
